Visual Mouse Designer v. 1.0 MOUSED.EXE ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿ (c) Arf Enterprises 1994 ษอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป บ บ บ บ บ บ บ Users Manual บ บ บ บ บ บ บ ศอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ page 1 What this program is ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿ This program is a frustrated DOS programmers response to all the so-called "visual" programming tools for Windows programmers. I was programming mouse routines today and crunching all the numbers for the cursor bit mask when I realized I would be having a whole lot more fun it the computer would just tell me what the numbers should be. That's when I decided to write this program. It behaves like many paint programs, though you will immediately notice there are no toolbars or color palettes. The reason for this is that the bitmap for a standard graphics mode cursor is small, 16 X 16, and you get four color selections, WHITE, BLACK, BACKGROUND (which is whatever color is on the screen behind the cursor) and INVERTED (in which the color is determined by an XOR with the number 16). That's all you get folks, sorry, I don't write 'em, I just report 'em. After you are satisfied with the appearance of the cursor, select the Make ASM source or Make C++ source buttons. A file is created in the same directory as MOUSED.EXE titled "m_curs?.###" where "?" is the sequence number (0, 1, 2, 3...) depending on how many other created files are in the directory, and "###" = either ".ASM" or ".CPP", depending on the flavor you selected. How to Use the Visual Mouse Cursor Designer ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿ First all, the only input the program accepts is from the mouse. I made an assumption that anyone who was designing a mouse cursor has a mouse hooked up to their computer. Understanding that there may be a person or two using a computer to generate source code which will be compiled later on another machine who doesn't have a mouse available, all I can tell you is sorry but I put a lot of effort into this program for a $5.00 price tag. When the program starts, there is a 16 X 16 grid displayed in the upper left area of the screen. This is the drawing area. There is a smaller rectangular area just to the right of the drawing area. This is called the display area. As you draw your cursor in the drawing area, an actual scale rendering is displayed in the display area. This is so you can see what the cursor is really going to look like. page 2 At start up, all of the squares in the drawing area are BLUE, with the exception of the upper left square which is displayed in RED. The RED square just shows where the "hot spot" is (explained below) and the color is actually blue. The BLUE color is the BACKGROUND or DEFAULT color. Any square that is left BLUE when you generate a source code listing will show as whatever background color is underneath the actual mouse cursor when it is displayed in a program. The left mouse button, when the mouse cursor is touching the inside of a square in the drawing area, will toggle between three colors, WHITE, YELLOW (inverted) and BLUE (BACKGROUND). As with BLUE, YELLOW is not really YELLOW. YELLOW is BLUE inverted (XOR'd with 0ffh). Any part of the mouse cursor which shows YELLOW in the Visual Mouse Cursor Designer will show up as the inverted color of whatever color is under that part of the cursor. The right mouse button toggles between BLACK and BLUE (BACKGROUND). You can drag the mouse cursor with either button down. Regardless of the color that is being changed the new color is the same as the first square painted when the mouse button was depressed. You can paint directly over a RED hot spot, the hot spot stays where it was last seen until you use the "Set" button under the drawing area. If you've painted over the hot spot and just want to see where you put it, use the "Show" button under the drawing area. Even though the square reappears RED, it is still whatever color was assigned to that square. You should set the hot spot to a position relevant to the cursor. On an arrow cursor this would typically be the tip of the arrow, the tip of a finger for a hand cursor, or the center of a cross hair cursor. The location of the hot spot is what is reported by DOS when you call for the location of the mouse cursor. After you have created your masterpiece, move the mouse cursor into the display box and click the left mouse button. The default arrow cursor is then replaced with your cursor. You can even use your new cursor to make changes in the drawing area. This will also give you an idea of what the inverted areas of the cursor will look like. To restore the cursor to the default cursor, just pass the cursor over any button. The cursor will appear as a hand, and then back to an arrow when the cursor has moved off of the button. Now that you are ready to produce the source code, select either the Make ASM Source or the Make C++ Source buttons. A file titled m_curs? with an ASM or CPP extension is created. The "?" is a number starting with 0 that is assigned depending on how many m_curs files already reside in your working directory. page 3 This is not "stand alone" code, though the functions created need little modification to work. For the C++ version, the function is listed as void mouse_curs();. You can leave that name and call it this way, but I recomend that you change it to whatever name you want. This function needs DOS.H included in the source, as well as an appropriate prototype. For the ASM version, there are three lines that should be changed to whatever name you want. These are PUBLIC mouse_curs (example PUBLIC mouse_hand_curs mouse_curs process far (example mouse_hand_curs process far) and mouse_curs endp (example mouse_hand_curs endp) You are responsible for putting this code into the code segment of your program and ensuring adequate stack size. The ASM routine only takes up 64 bytes of stack space so this generally should not be a problem. This method is probably a tad slower than creating a data member and shooting a pointer at it, but the memor overhead is lessened, though in either case the net effect is undetectable. If you call the compiled ASM source from a C language program, use extern "C" void far mouse_curs(); as a prototype. You are not required to leave my comments in the source code listing or provide me with any royalties or acknowledgements in the programs you write. Technical "Stuff" ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿ I made an assumption that anyone who finds this program useful would already know something about mouse programming. Nonetheless, here is the obligatory technical part of this manual which should give you an idea on how to utilize the produced source code. Before you can change the mouse cursor, you have to initialize the mouse driver. All mouse functions are related to interrupt 33H (0x33). In ASM it's easy. mov ax, 0 ;function 0 int 33H ;its initialzed ret ;if AX = 0, then initializtion failed. ;any other value (ffffh) means OK page 4 In C++ you can use union REGS regs; regs.x.ax = 0; int86(0x33, ®s, ®s); //regs.x.ax can be examined, if 0 then initialization failed, if //0xffff we've got lift off, folks! Once initialzed, the mouse cursor needs to be turned on, though you can change the mouse cursor before it is displayed, it doesn't matter. You need to be aware that any change in the graphics mode (for example text mode to VGA) results in the mouse cursor being hidden and it will need to be displayed again. In ASM use mov ax, 01h int 33h and provided the mouse driver was initialized as discussed above a mouse cursor will appear. Now, how does the code my program produces work? You may have noticed that there are 32 words pushed onto the stack (or 32 integers stored in an array in the C++ code). The mouse cursor is made up of two bitmaps of 16 X 16 bits each. Each word or integer comprises one row of each bitmap. This means there are two bits for every pixel in the mouse cursor, one from each bitmap, which determine the color of that bit. Accordingly there are four possibilities. The first bitmap is known as the screen mask, the second is known as the cursor map. The color is determined as follows screen mask cursor mask 1 0 = BACKGROUND (clear) 1 1 = INVERTED 0 1 = WHITE 0 0 = BLACK The BACKGROUND and INVERTED colors are determined by the color of the pixel under the mouse cursor. If BACKGROUND the color is unchanged, if INVERTED the value of the color assigned to that pixel is XOR'd with value 16 (fh or 0xf). The location of the "hot spot" is mov'd into BX and CX, these values are relative to the bit field, i.e. 0,0 is the upper left most bit, 1,0 is the next bit to the right, etc. The "hot spot" denotes the specific pixel in the mouse cursor which is viewed by DOS as the actual mouse location. If you read the location using function 5h page 5 this will tell you the location of the "hot spot". Generally you will want to assign this spot to a relevant position in the cursor, such as the tip of an arrow, the tip of a finger on a hand cursor, or the center of a target. Anyway, in the ASM model these values are pushed onto the stack, and the segment address of both bitmaps are placed in ES and the offset in DX. The same thing happens in the C++ model, only the values are placed in an integer array whose address is placed in sregs.es and regs.x.ax respectively. There are a number of books out there that explain mouse programming much better than I do so check out your local bookstore. What you get when you register ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿ Well, here comes the pitch. I don't really have anything to offer, other than the fact if I catch you using my product to produce software I'll sue you. Odds of that are pretty slim though. The price tag on this is $5.00. This is my third shareware program and nobody has sent me a dime. This means either I'm creating programs that nobody wants or needs, or people just like to rip me off. Either way, this could very easily be my last venture into Shareware because right now it's a bust. The only thing I can offer you for registering this program, besides the fact it happens to be the right thing to do, is "free" technical assistence in using this program or mouse programming questions in general. You can contact me at the various sources listed when my program terminates. I'm also available for contract programming either by myself or part of a team. I use C++ for both DOS and Windows programming, as well as assembly language. If push comes to shove I've been known to use a number of different flavors of BASIC as well. Appreciate you trying my product. Leonard Gragson ARF Enterprises P.O. Box 26413 Shawnee Mission, Kansas 66225 (913) 764-9091 CompuServe 73131,1034 Prodigy YBMY91A Internet ybmy91a@prodigy.com